#include "ParticleTools.h"
namespace FireCloud{
GLuint ParticleTools::rand_gluint(GLuint min,GLuint max){
	return (GLuint)(min+(max-min)*((float)rand()/(float)RAND_MAX));
}
GLfloat ParticleTools::rand_glfloat(GLfloat min,GLfloat max){
	return (min+(max-min)*((float)rand()/(float)RAND_MAX));
}
GLfloat ParticleTools::ratio_glfloat(GLfloat min,GLfloat diff,GLfloat ratio){
	return min+diff*ratio;
}
void ParticleTools::ratio_glcolor(const GLcolor &min,const GLcolor &diff,GLcolor &out,GLfloat ratio){
	out.r = ratio_glfloat(min.r,diff.r,ratio);
	out.g = ratio_glfloat(min.g,diff.g,ratio);
	out.b = ratio_glfloat(min.b,diff.b,ratio);
	out.a = ratio_glfloat(min.a,diff.a,ratio);
}
void ParticleTools::diff_glcolor(const GLcolor &min,const GLcolor &max,GLcolor &out){
	out.r = max.r - min.r;
	out.g = max.g - min.g;
	out.b = max.b - min.b;
	out.a = max.a - min.a;
}
void ParticleTools::rand_glcolor(const GLcolor &min,const GLcolor &max,GLcolor &out){
	out.r = rand_glfloat(min.r,max.r);
	out.g = rand_glfloat(min.g,max.g);
	out.b = rand_glfloat(min.b,max.b);
	out.a = rand_glfloat(min.a,max.a);
}
void ParticleTools::add_glvector(GLvector &det,const GLvector &src){
	det.x += src.x;
	det.y += src.y;
	det.z += src.z;
}
}
